Merge pull request #10352 from daijoubu/patch-1
[inav.git] / docs / development / IDE - Visual Studio Code with Windows 10.md
blob2baec8b6c244521f875f2309da6423e2af7b66cf
1 # IDE - Visual Studio Code with Windows 10
3 ![Visual Studio Code](assets/vscode01.png)
5 [Visual Studio Code](https://code.visualstudio.com/) is probably the best free option for all Windows 10 users. It provides almost seamless integration with WSL running Ubuntu, syntax highlighting, building, and hardware debugging.
7 ## Setup
9 1. Setup build environment using [generic WSL guide](Building%20in%20Windows%2010%20with%20Linux%20Subsystem.md)
10 1. Download and install [Visual Studio Code](https://code.visualstudio.com/)
11 1. From the VS Code Extensions download [Remote - WSL](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl) plugin
12 1. Open INAV folder
13 1. Use `Ctrl + Shift + P` to run option `Remote-WSL: Reopen Folder in WSL`
14 1. Allow firewall and other permissions if requested
15 1. Install plugins in WSL workspace:
16     1. [C/C++ from Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) for C/C++ support
17     1. [Bookmarks](https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks) for simpler navigation
18 1. Configure the environment using the following snippets as a base
20 ### C propertiues
22 Edit file `./.vscode/c_cpp_properties.json` to setup enabled `defines`
24 ```
26     "configurations": [
27         {
28             "name": "Win32",
29             "includePath": [
30                 "${workspaceRoot}",
31                 "${workspaceRoot}/src/main/**"
32             ],
33             "browse": {
34                 "limitSymbolsToIncludedHeaders": false,
35                 "path": [
36                     "${workspaceRoot}/**"
37                 ]
38             },
39             "intelliSenseMode": "msvc-x64",
40             "cStandard": "c11",
41             "cppStandard": "c++17",
42             "defines": [,
43                 "USE_OSD",
44                 "USE_GYRO_NOTCH_1",
45                 "USE_GYRO_NOTCH_2",
46                 "USE_DTERM_NOTCH",
47                 "USE_ACC_NOTCH",
48                 "USE_GYRO_BIQUAD_RC_FIR2",
49                 "USE_D_BOOST",
50                 "USE_SERIALSHOT",
51                 "USE_ANTIGRAVITY",
52                 "USE_ASYNC_GYRO_PROCESSING",
53                 "USE_RPM_FILTER",
54                 "USE_GLOBAL_FUNCTIONS",
55                 "USE_DYNAMIC_FILTERS",
56                 "USE_DSHOT",
57                 "FLASH_SIZE 480",
58                 "USE_I2C_IO_EXPANDER",
59                 "USE_PCF8574",
60                 "USE_ESC_SENSOR"
61             ]
62         }
63     ],
64     "version": 4
66 ```
68 ### Tasks
70 Edit `./.vscode/tasks.json` to enable Building with `Ctrl + Shift + B` keyboard shortcut and from Command Console.
72 ```
74     // See https://go.microsoft.com/fwlink/?LinkId=733558
75     // for the documentation about the tasks.json format
76     "version": "2.0.0",
77     "tasks": [
78         {
79             "label": "Install/Update CMAKE",
80             "type": "shell",
81             "command": "mkdir -p build && cd build && cmake ..",
82             "group": "build",
83             "problemMatcher": [],
84             "options": {
85                 "cwd": "${workspaceFolder}"
86             }
87         },
88         {
89                         "label": "Compile autogenerated docs",
90                         "type": "shell",
91                         "command": "python3 src/utils/update_cli_docs.py",
92                         "problemMatcher": [],
93                         "options": {
94                                 "cwd": "${workspaceFolder}"
95                         }
96                 },
97         // Example of building a single target
98        {
99             "label": "Build Matek F722-WPX",
100             "type": "shell",
101             "command": "make MATEKF722WPX",
102             "group": "build",
103             "problemMatcher": [],
104             "options": {
105                 "cwd": "${workspaceFolder}/build"
106             }
107         },
108         // Example of building multiple targets
109         {
110             "label": "Build Matek F405-STD & WING",
111             "type": "shell",
112             "command": "make MATEKF405 MATEKF405SE",
113             "group": "build",
114             "problemMatcher": [],
115             "options": {
116                 "cwd": "${workspaceFolder}/build"
117             }
118         }
119     ]